package blackspire.model.issue;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import blackspire.model.user.User;

@Entity
@Table(name = "ISSUE", uniqueConstraints = @UniqueConstraint(columnNames =
{ "ID"}))
public class Issue
{
	@Id
	@GeneratedValue
	private Integer id;

	private String shortDescription;
	private User assignedTo;
	
	public Integer getId()
	{
		return id;
	}

	public void setId(Integer id)
	{
		this.id = id;
	}

	@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
	@JoinTable(name="USER",
        joinColumns = @JoinColumn(name="ASSIGNEDTO"),
        inverseJoinColumns = @JoinColumn(name="ID")
    )
	public User getAssignedTo()
	{
		return assignedTo;
	}

	public void setAssignedTo(User assignedTo)
	{
		this.assignedTo = assignedTo;
	}

	public String getShortDescription()
	{
		return shortDescription;
	}

	public void setShortDescription(String shortDescription)
	{
		this.shortDescription = shortDescription;
	}
}
